<?php

/**
 * PeriodoAcademico form.
 *
 * @package    sistema_estadisticas
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class PeriodoAcademicoForm extends BasePeriodoAcademicoForm
{

	public function configure()
	{
		$this->widgetSchema['f_inicio'] = new WidgetFormDatePick();
		$this->widgetSchema['f_fin'] = new WidgetFormDatePick();

		$this->validatorSchema->setPostValidator(new ValidatorFechas(array('begin_date_column' => 'f_inicio', 'end_date_column' => 'f_fin')));
	}

	protected function doSave($con = null)
	{
		parent::doSave($con);
		if ($this->getObject()->vigente)
		{
			$table = PeriodoAcademicoTable::getInstance();
			$table->setConnection($con);
			$table->actualizaPeriodoVigente($this->getObject()->id);
		}
	}

}
